<template>
  <div class="item-checkbox">
    <el-checkbox-group
      v-bind="$attrs"
      v-model="Val"
      @change="change ? change(Val) : none()"
    >
      <el-checkbox
        v-for="ch in dicData"
        :label="ch[props.value || 'value'] || ch"
        :key="ch[props.value || 'value'] || ch"
        >{{ ch[props.label || "label"] || ch }}</el-checkbox
      >
    </el-checkbox-group>
  </div>
</template>

<script>
export default {
  name: "Checkbox",
  data() {
    return {
      Val: "",
    };
  },
  props: {
    value: {
      type: Array,
      default: () => [],
    },
    props: {
      type: Object,
      default: () => {},
    },

    dicData: {
      type: Array,
      default: () => [],
    },

    change: {
      type: Function,
      default: () => () => {},
    },
  },
  watch: {
    Val: function (newVal) {
      this.$emit("update:value", newVal);
    },
  },
  created() {
    this.Val = this.value;
  },
  methods: {
    none() {
      return false;
    },
  },
};
</script>


<style scoped lang="less">
</style>
